﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Plat.WfProcess.Common;
using Plat.WfProcess.Business;

namespace Plat.WfProcess.Engine
{
    internal class ActivityExecutionContexttRunning : ActivityExecutionContext
    {
        internal ActivityExecutionContexttRunning(long taskID,
            ActivityResource activityResource) 
            : base(activityResource)
        {
            TaskViewEntity taskInstance = (new TaskManager()).Select(taskID);
            ActivityInstanceEntity activityInstance = (new ActivityInstanceManager()).Select(taskInstance.ActivityInstanceGUID);

            base.Activity = activityInstance.Activity;

            string processInstanceGUID = activityInstance.ProcessInstanceGUID;
            ProcessInstanceEntity processInstance = new ProcessInstanceManager(processInstanceGUID)
                .Select(processInstanceGUID);

            base.ProcessInstance = processInstance;
            base.ActivityInstance = activityInstance;
            base.TaskID = taskID;
        }
    }
}
